//
//  CorgiBaseTableViewController.swift
//  weibo
//
//  Created by Corgi on 17/3/20.
//  Copyright © 2017年 cocoaHangTou. All rights reserved.
//

import UIKit

class CorgiBaseTableViewController: UITableViewController, CorgiVisitorLoginViewDelegate {

    var userLogin = CorgiUserAccountViewModel.shared.userLogin
    
    lazy var visitorView = CorgiVisitorLoginView(frame: UIScreen.main.bounds)
    
    override func loadView() {
        
        if userLogin == true {
        
            super.loadView()
            
        } else {
            
            self.view = visitorView
            
            self.visitorView.delegate = self
        }
        
    }
    
    //登录
    ///需要modal展示,不能破坏控制器逻辑结构
    func userWillLogin(visitor: CorgiVisitorLoginView) {
        print(#function)
        
        let oauth = CorgiOAuthViewController()
        
        let nav = UINavigationController(rootViewController: oauth)
        
        self.present(nav, animated: true, completion: nil)
    }
    
    //注册
    func userWillRegister(visitorView: CorgiVisitorLoginView) {
        print(#function)
    }
    
    override func viewDidLoad() {
        super.viewDidLoad()

        
    }

    override func didReceiveMemoryWarning() {
        super.didReceiveMemoryWarning()
        // Dispose of any resources that can be recreated.
    }


}
